﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CNdotnet.Ezsocio.ContactService;

namespace CNdotnet.Ezsocio.ContactFromEmail
{
    public abstract class EmailHandlerBase : IEmailHandler
    {
        private String _name = String.Empty;
        public EmailHandlerBase(String name)
        {
            this._name = name;
        }

        public virtual string Name
        {
            get 
            {
                return _name;    
            }
        }

        public virtual Encoding DefaultEncoding
        {
            get
            {
                return Encoding.GetEncoding("gb2312");
            }
        }

        public abstract string StartUrl { get; }

        public virtual bool CanProcess(string name)
        {
            if (name.ToLower() != Name.ToLower())
            {
                return false;
            }
            return true;
        }

        public abstract List<ContactMember> FetchContact(string userName, string password);
    }
}
